package com.neusoft.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.neusoft.entity.BookClass;
import com.neusoft.entity.BookClassExample;
import com.neusoft.mapper.BookClassMapper;
import com.neusoft.service.BookClassService;

@Service
public class BookClassServiceImpl implements BookClassService {

	@Autowired
	BookClassMapper bookClassMapper;

	@Override
	@Transactional
	public int removeById(Integer bcId) {
		return bookClassMapper.deleteByPrimaryKey(bcId);
	}

	@Override
	public int insertSelective(BookClass record) {
		return bookClassMapper.insertSelective(record);
	}

	@Override
	public List<BookClass> loadListByExample(BookClassExample example) {
		return bookClassMapper.selectByExample(example);
	}

	@Override
	public BookClass loadById(Integer bcId) {
		return bookClassMapper.selectByPrimaryKey(bcId);
	}

	@Override
	public int updateByIdSelective(BookClass record) {
		return bookClassMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public List<BookClass> loadListByClassName(String className) {
		BookClassExample example = new BookClassExample();
		BookClassExample.Criteria bCriteria = example.createCriteria();
		bCriteria.andBookClassEqualTo(className);

		return bookClassMapper.selectByExample(example);
	}

}
